package com.vite.system.service.impl;

import com.vite.system.domain.SysOperateLog;
import com.vite.system.mapper.SysOperateLogMapper;
import com.vite.system.service.ISysOperateLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 操作日志 服务层处理
 */
@Service
@RequiredArgsConstructor
public class SysOperateLogServiceImpl implements ISysOperateLogService
{
    private final SysOperateLogMapper logMapper;

    /**
     * 新增操作日志
     * 
     * @param log 操作日志对象
     */
    @Override
    public void insertOperateLog(SysOperateLog log)
    {
        logMapper.insertOperateLog(log);
    }

    /**
     * 查询系统操作日志集合
     * 
     * @param log 操作日志对象
     * @return 操作日志集合
     */
    @Override
    public List<SysOperateLog> selectOperateLogList(SysOperateLog log)
    {
        return logMapper.selectOperateLogList(log);
    }

    /**
     * 批量删除系统操作日志
     * 
     * @param operateIds 需要删除的操作日志ID
     * @return 结果
     */
    @Override
    public int deleteOperateLogByIds(Long[] operateIds)
    {
        return logMapper.deleteOperateLogByIds(operateIds);
    }

    /**
     * 查询操作日志详细
     * 
     * @param operateId 操作ID
     * @return 操作日志对象
     */
    @Override
    public SysOperateLog selectOperateLogById(Long operateId)
    {
        return logMapper.selectOperateLogById(operateId);
    }

    /**
     * 清空操作日志
     */
    @Override
    public void cleanOperateLog()
    {
        logMapper.cleanOperateLog();
    }

    @Override
    public List<Map<String, Object>> getSuccessOperationStats(SysOperateLog log) {
        return logMapper.getSuccessOperationStats(log);
    }

    @Override
    public List<Map<String, Object>> getFailureOperationStats(SysOperateLog log) {
        return logMapper.getFailureOperationStats(log);
    }

    @Override
    public List<Map<String, Object>> getStatusStats(SysOperateLog log) {
        return logMapper.getStatusStats(log);
    }

    @Override
    public List<Map<String, Object>> getModuleOperationStats(SysOperateLog log) {
        return logMapper.getModuleOperationStats(log);
    }
}
